home *** CD-ROM | disk | FTP | other *** search
open in:
MacOS 8.1
|
Win98
|
DOS
browse contents |
view JSON data
|
view as text
This file was processed as: LaTeX Document
(document/latex).
Confidence | Program | Detection | Match Type | Support
|
---|
100%
| dexvert
| LaTeX Document (document/latex)
| magic
| Supported |
1%
| dexvert
| NWiper Show (other/nWiperShow)
| ext
| Unsupported |
1%
| dexvert
| Text File (text/txt)
| fallback
| Supported |
100%
| file
| LaTeX document, ASCII text, with CR line terminators
| default
| |
100%
| checkBytes
| Printable ASCII
| default
| |
100%
| perlTextCheck
| Likely Text (Perl)
| default
| |
100%
| siegfried
| fmt/281 LaTeX (Subdocument)
| default
| |
100%
| detectItEasy
| Format: plain text[CR]
| default (weak)
|
|
id metadata |
---|
key | value |
---|
macFileType | [TEXT] |
macFileCreator | [MPS ] |
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| 25 20 43 6f 70 79 72 69 | 67 68 74 20 31 39 39 31 |% Copyri|ght 1991|
|00000010| 20 62 79 20 4e 6f 72 6d | 61 6e 20 52 61 6d 73 65 | by Norm|an Ramse|
|00000020| 79 2e 20 20 41 6c 6c 20 | 72 69 67 68 74 73 20 72 |y. All |rights r|
|00000030| 65 73 65 72 76 65 64 2e | 0d 25 20 53 65 65 20 66 |eserved.|.% See f|
|00000040| 69 6c 65 20 43 4f 50 59 | 52 49 47 48 54 20 66 6f |ile COPY|RIGHT fo|
|00000050| 72 20 6d 6f 72 65 20 69 | 6e 66 6f 72 6d 61 74 69 |r more i|nformati|
|00000060| 6f 6e 2e 0d 5c 73 75 62 | 73 65 63 74 69 6f 6e 7b |on..\sub|section{|
|00000070| 49 64 65 6e 74 69 66 79 | 69 6e 67 20 74 68 65 20 |Identify|ing the |
|00000080| 73 70 65 63 69 61 6c 20 | 7b 5c 74 74 20 6e 6f 77 |special |{\tt now|
|00000090| 65 62 7d 20 63 6f 6e 74 | 72 6f 6c 20 73 65 71 75 |eb} cont|rol sequ|
|000000a0| 65 6e 63 65 73 7d 0d 54 | 68 69 73 20 66 69 6c 65 |ences}.T|his file|
|000000b0| 20 69 73 20 73 75 70 70 | 6f 73 65 64 20 74 6f 20 | is supp|osed to |
|000000c0| 63 6f 6e 74 61 69 6e 20 | 61 6c 6c 20 74 68 65 20 |contain |all the |
|000000d0| 64 65 66 69 6e 69 74 69 | 6f 6e 73 20 6f 66 20 68 |definiti|ons of h|
|000000e0| 6f 77 20 64 69 66 66 65 | 72 65 6e 74 0d 74 68 69 |ow diffe|rent.thi|
|000000f0| 6e 67 73 20 61 72 65 20 | 64 69 73 74 69 6e 67 75 |ngs are |distingu|
|00000100| 69 73 68 65 64 20 69 6e | 20 74 68 65 20 73 6f 75 |ished in| the sou|
|00000110| 72 63 65 20 74 65 78 74 | 2e 0d 40 0d 44 6f 63 75 |rce text|..@.Docu|
|00000120| 6d 65 6e 74 61 74 69 6f | 6e 20 69 73 20 69 6e 74 |mentatio|n is int|
|00000130| 72 6f 64 75 63 65 64 20 | 6f 6e 6c 79 20 62 79 20 |roduced |only by |
|00000140| 61 6e 20 61 74 20 73 69 | 67 6e 20 28 40 29 20 6f |an at si|gn (@) o|
|00000150| 6e 20 61 20 6c 69 6e 65 | 20 62 79 20 69 74 73 65 |n a line| by itse|
|00000160| 6c 66 0d 28 6f 70 74 69 | 6f 6e 61 6c 6c 79 20 66 |lf.(opti|onally f|
|00000170| 6f 6c 6c 6f 77 65 64 20 | 62 79 20 73 70 61 63 65 |ollowed |by space|
|00000180| 73 29 2e 0d 49 74 20 63 | 6f 6e 74 69 6e 75 65 73 |s)..It c|ontinues|
|00000190| 20 75 70 20 74 6f 20 6e | 65 77 20 64 6f 63 75 6d | up to n|ew docum|
|000001a0| 65 6e 74 61 74 69 6f 6e | 20 6f 72 20 61 20 6d 6f |entation| or a mo|
|000001b0| 64 75 6c 65 20 64 65 66 | 69 6e 69 74 69 6f 6e 2e |dule def|inition.|
|000001c0| 0d 41 20 6d 6f 64 75 6c | 65 20 64 65 66 69 6e 69 |.A modul|e defini|
|000001d0| 74 69 6f 6e 20 69 73 20 | 61 20 6d 6f 64 75 6c 65 |tion is |a module|
|000001e0| 20 6e 61 6d 65 2c 20 66 | 6f 6c 6c 6f 77 65 64 20 | name, f|ollowed |
|000001f0| 62 79 20 6f 6e 65 20 65 | 71 75 61 6c 73 20 73 69 |by one e|quals si|
|00000200| 67 6e 20 28 3d 29 2c 0d | 70 6f 73 73 69 62 6c 79 |gn (=),.|possibly|
|00000210| 20 66 6f 6c 6c 6f 77 65 | 64 20 62 79 20 77 68 69 | followe|d by whi|
|00000220| 74 65 20 73 70 61 63 65 | 2c 20 6f 6e 20 61 20 6c |te space|, on a l|
|00000230| 69 6e 65 20 62 79 20 69 | 74 73 65 6c 66 2e 0d 41 |ine by i|tself..A|
|00000240| 20 6d 6f 64 75 6c 65 20 | 6e 61 6d 65 20 69 73 20 | module |name is |
|00000250| 61 6e 79 20 74 65 73 74 | 20 65 6e 63 6c 6f 73 65 |any test| enclose|
|00000260| 64 20 69 6e 20 64 6f 75 | 62 6c 65 20 61 6e 67 6c |d in dou|ble angl|
|00000270| 65 20 62 72 61 63 6b 65 | 74 73 20 28 5b 5b 40 3c |e bracke|ts ([[@<|
|00000280| 3c 2e 2e 2e 40 3e 3e 5d | 5d 29 2e 0d 54 68 65 20 |<...@>>]|])..The |
|00000290| 60 60 75 6e 6e 61 6d 65 | 64 27 27 20 6d 6f 64 75 |``unname|d'' modu|
|000002a0| 6c 65 20 69 73 20 63 61 | 6c 6c 65 64 20 2a 20 28 |le is ca|lled * (|
|000002b0| 74 68 61 74 20 69 73 2c | 20 5b 5b 40 3c 3c 2a 40 |that is,| [[@<<*@|
|000002c0| 3e 3e 5d 5d 29 2e 0d 0d | 44 6f 75 62 6c 65 20 61 |>>]])...|Double a|
|000002d0| 6e 67 6c 65 20 62 72 61 | 63 6b 65 74 73 20 6d 61 |ngle bra|ckets ma|
|000002e0| 79 20 62 65 20 65 73 63 | 61 70 65 64 20 69 6e 20 |y be esc|aped in |
|000002f0| 73 6f 75 72 63 65 20 62 | 79 20 70 72 65 63 65 64 |source b|y preced|
|00000300| 69 6e 67 20 74 68 65 6d | 20 77 69 74 68 0d 74 68 |ing them| with.th|
|00000310| 65 20 61 74 20 73 69 67 | 6e 2e 0d 4e 6f 20 6f 74 |e at sig|n..No ot|
|00000320| 68 65 72 20 63 68 61 72 | 61 63 74 65 72 2c 20 6e |her char|acter, n|
|00000330| 6f 74 20 65 76 65 6e 20 | 74 68 65 20 61 74 20 73 |ot even |the at s|
|00000340| 69 67 6e 2c 20 6e 65 65 | 64 73 20 74 6f 20 62 65 |ign, nee|ds to be|
|00000350| 20 65 73 63 61 70 65 64 | 2e 0d 54 68 69 73 20 6d | escaped|..This m|
|00000360| 61 6b 65 73 20 66 6f 72 | 20 6d 6f 72 65 20 72 65 |akes for| more re|
|00000370| 61 64 61 62 6c 65 20 73 | 6f 75 72 63 65 2c 20 62 |adable s|ource, b|
|00000380| 75 74 20 6d 61 6b 65 73 | 20 69 74 20 69 6d 70 6f |ut makes| it impo|
|00000390| 73 73 69 62 6c 65 20 74 | 6f 20 70 75 74 20 61 6e |ssible t|o put an|
|000003a0| 20 0d 61 74 20 73 69 67 | 6e 20 69 6d 6d 65 64 69 | .at sig|n immedi|
|000003b0| 61 74 65 6c 79 20 62 65 | 66 6f 72 65 20 61 20 6d |ately be|fore a m|
|000003c0| 6f 64 75 6c 65 20 6e 61 | 6d 65 2e 0d 49 66 20 77 |odule na|me..If w|
|000003d0| 65 20 6c 69 6b 65 64 20 | 77 65 20 63 6f 75 6c 64 |e liked |we could|
|000003e0| 20 74 72 79 20 74 6f 20 | 68 61 63 6b 20 74 68 69 | try to |hack thi|
|000003f0| 73 20 62 79 20 63 72 65 | 61 74 69 6e 67 20 61 20 |s by cre|ating a |
|00000400| 70 72 65 64 65 66 69 6e | 65 64 20 6d 6f 64 75 6c |predefin|ed modul|
|00000410| 65 20 74 68 61 74 20 0d | 65 78 70 61 6e 64 73 20 |e that .|expands |
|00000420| 74 6f 20 61 6e 20 61 74 | 20 73 69 67 6e 2c 20 62 |to an at| sign, b|
|00000430| 75 74 20 49 20 77 6f 6e | 27 74 20 62 6f 74 68 65 |ut I won|'t bothe|
|00000440| 72 2e 0d 0d 3c 3c 2a 3e | 3e 3d 0d 23 69 6e 63 6c |r...<<*>|>=.#incl|
|00000450| 75 64 65 20 3c 73 74 64 | 6c 69 62 2e 68 3e 0d 23 |ude <std|lib.h>.#|
|00000460| 69 6e 63 6c 75 64 65 20 | 3c 73 74 64 69 6f 2e 68 |include |<stdio.h|
|00000470| 3e 0d 23 69 6e 63 6c 75 | 64 65 20 3c 73 74 72 69 |>.#inclu|de <stri|
|00000480| 6e 67 2e 68 3e 0d 23 69 | 6e 63 6c 75 64 65 20 3c |ng.h>.#i|nclude <|
|00000490| 63 74 79 70 65 2e 68 3e | 0d 23 69 6e 63 6c 75 64 |ctype.h>|.#includ|
|000004a0| 65 20 3c 61 73 73 65 72 | 74 2e 68 3e 0d 23 69 6e |e <asser|t.h>.#in|
|000004b0| 63 6c 75 64 65 20 22 6d | 61 72 6b 75 70 2e 68 22 |clude "m|arkup.h"|
|000004c0| 0d 23 69 6e 63 6c 75 64 | 65 20 22 73 74 72 73 61 |.#includ|e "strsa|
|000004d0| 76 65 2e 68 22 0d 23 69 | 6e 63 6c 75 64 65 20 22 |ve.h".#i|nclude "|
|000004e0| 65 72 72 6f 72 73 2e 68 | 22 0d 0d 3c 3c 64 61 74 |errors.h|"..<<dat|
|000004f0| 61 20 64 65 66 69 6e 69 | 74 69 6f 6e 73 3e 3e 0d |a defini|tions>>.|
|00000500| 0d 3c 3c 43 20 66 75 6e | 63 74 69 6f 6e 73 3e 3e |.<<C fun|ctions>>|
|00000510| 0d 40 20 0d 54 6f 20 71 | 75 6f 74 65 20 66 72 6f |.@ .To q|uote fro|
|00000520| 6d 20 74 68 65 20 6d 61 | 6e 20 70 61 67 65 3a 0d |m the ma|n page:.|
|00000530| 5c 62 65 67 69 6e 7b 71 | 75 6f 74 65 7d 20 0d 41 |\begin{q|uote} .A|
|00000540| 20 0d 7b 5c 65 6d 20 6e | 6f 77 65 62 20 7d 0d 66 | .{\em n|oweb }.f|
|00000550| 69 6c 65 20 63 6f 6e 73 | 69 73 74 73 20 6f 66 20 |ile cons|ists of |
|00000560| 61 20 73 65 71 75 65 6e | 63 65 20 6f 66 0d 7b 5c |a sequen|ce of.{\|
|00000570| 65 6d 20 63 68 75 6e 6b | 73 2c 7d 0d 77 68 69 63 |em chunk|s,}.whic|
|00000580| 68 20 6d 61 79 20 61 70 | 70 65 61 72 20 69 6e 20 |h may ap|pear in |
|00000590| 61 6e 79 20 6f 72 64 65 | 72 2e 0d 7b 5c 65 6d 20 |any orde|r..{\em |
|000005a0| 6e 6f 77 65 62 7d 0d 73 | 75 70 70 6f 72 74 73 20 |noweb}.s|upports |
|000005b0| 74 77 6f 20 6b 69 6e 64 | 73 20 6f 66 20 63 68 75 |two kind|s of chu|
|000005c0| 6e 6b 73 3a 20 64 6f 63 | 75 6d 65 6e 74 61 74 69 |nks: doc|umentati|
|000005d0| 6f 6e 20 63 68 75 6e 6b | 73 20 61 6e 64 20 63 6f |on chunk|s and co|
|000005e0| 64 65 20 63 68 75 6e 6b | 73 2e 0d 44 6f 63 75 6d |de chunk|s..Docum|
|000005f0| 65 6e 74 61 74 69 6f 6e | 20 63 68 75 6e 6b 73 20 |entation| chunks |
|00000600| 62 65 67 69 6e 20 77 69 | 74 68 20 61 6e 20 61 74 |begin wi|th an at|
|00000610| 20 73 69 67 6e 20 28 40 | 29 20 61 74 20 74 68 65 | sign (@|) at the|
|00000620| 20 62 65 67 69 6e 6e 69 | 6e 67 20 6f 66 20 61 20 | beginni|ng of a |
|00000630| 6c 69 6e 65 2c 0d 66 6f | 6c 6c 6f 77 65 64 20 62 |line,.fo|llowed b|
|00000640| 79 20 61 20 73 70 61 63 | 65 20 0d 28 6f 72 20 77 |y a spac|e .(or w|
|00000650| 69 74 68 20 61 6e 20 61 | 74 20 73 69 67 6e 20 6f |ith an a|t sign o|
|00000660| 6e 20 61 20 6c 69 6e 65 | 20 62 79 20 69 74 73 65 |n a line| by itse|
|00000670| 6c 66 29 2e 0d 54 68 65 | 79 20 68 61 76 65 20 6e |lf)..The|y have n|
|00000680| 6f 20 6e 61 6d 65 73 2e | 0d 43 6f 64 65 20 63 68 |o names.|.Code ch|
|00000690| 75 6e 6b 73 20 62 65 67 | 69 6e 20 77 69 74 68 0d |unks beg|in with.|
|000006a0| 24 24 5c 68 62 6f 78 7b | 5c 74 74 40 3c 3c 7b 5c |$$\hbox{|\tt@<<{\|
|000006b0| 65 6d 20 63 68 75 6e 6b | 20 6e 61 6d 65 5c 2f 7d |em chunk| name\/}|
|000006c0| 40 3e 3e 3d 7d 24 24 0d | 6f 6e 20 61 20 6c 69 6e |@>>=}$$.|on a lin|
|000006d0| 65 20 62 79 20 69 74 73 | 65 6c 66 2e 0d 54 68 65 |e by its|elf..The|
|000006e0| 20 6c 65 66 74 20 64 6f | 75 62 6c 65 20 61 6e 67 | left do|uble ang|
|000006f0| 6c 65 20 62 72 61 63 6b | 65 74 20 28 7b 5c 74 74 |le brack|et ({\tt|
|00000700| 20 40 3c 3c 7d 29 20 6d | 75 73 74 20 62 65 20 69 | @<<}) m|ust be i|
|00000710| 6e 20 74 68 65 20 66 69 | 72 73 74 20 63 6f 6c 75 |n the fi|rst colu|
|00000720| 6d 6e 2e 0d 43 68 75 6e | 6b 73 20 61 72 65 20 74 |mn..Chun|ks are t|
|00000730| 65 72 6d 69 6e 61 74 65 | 64 20 62 79 20 74 68 65 |erminate|d by the|
|00000740| 20 62 65 67 69 6e 6e 69 | 6e 67 20 6f 66 20 61 6e | beginni|ng of an|
|00000750| 6f 74 68 65 72 20 63 68 | 75 6e 6b 2c 20 6f 72 20 |other ch|unk, or |
|00000760| 62 79 20 65 6e 64 20 6f | 66 20 66 69 6c 65 2e 0d |by end o|f file..|
|00000770| 49 66 20 74 68 65 20 66 | 69 72 73 74 20 6c 69 6e |If the f|irst lin|
|00000780| 65 20 69 6e 20 74 68 65 | 20 66 69 6c 65 20 64 6f |e in the| file do|
|00000790| 65 73 20 6e 6f 74 20 73 | 69 67 6e 61 6c 20 74 68 |es not s|ignal th|
|000007a0| 65 20 62 65 67 69 6e 6e | 69 6e 67 20 6f 66 20 61 |e beginn|ing of a|
|000007b0| 20 64 6f 63 75 6d 65 6e | 74 61 74 69 6f 6e 0d 6f | documen|tation.o|
|000007c0| 72 20 63 6f 64 65 20 63 | 68 75 6e 6b 2c 20 74 68 |r code c|hunk, th|
|000007d0| 65 20 66 69 72 73 74 20 | 63 68 75 6e 6b 20 69 73 |e first |chunk is|
|000007e0| 20 61 73 73 75 6d 65 64 | 20 74 6f 20 62 65 20 61 | assumed| to be a|
|000007f0| 20 64 6f 63 75 6d 65 6e | 74 61 74 69 6f 6e 20 63 | documen|tation c|
|00000800| 68 75 6e 6b 2e 0d 5c 65 | 6e 64 7b 71 75 6f 74 65 |hunk..\e|nd{quote|
|00000810| 7d 20 0d 40 0d 3c 3c 64 | 61 74 61 20 64 65 66 69 |} .@.<<d|ata defi|
|00000820| 6e 69 74 69 6f 6e 73 3e | 3e 3d 0d 63 68 61 72 20 |nitions>|>=.char |
|00000830| 61 74 5f 73 69 67 6e 20 | 3d 20 27 40 27 3b 20 20 |at_sign |= '@'; |
|00000840| 20 20 20 20 20 20 20 20 | 20 20 20 2f 2a 20 73 68 | | /* sh|
|00000850| 6f 75 6c 64 20 62 65 20 | 74 68 65 20 6f 6e 6c 79 |ould be |the only|
|00000860| 20 70 6c 61 63 65 20 27 | 40 27 20 69 73 20 6d 65 | place '|@' is me|
|00000870| 6e 74 69 6f 6e 65 64 20 | 2a 2f 0d 40 20 25 64 65 |ntioned |*/.@ %de|
|00000880| 66 20 61 74 5f 73 69 67 | 6e 0d 3c 3c 68 65 61 64 |f at_sig|n.<<head|
|00000890| 65 72 3e 3e 3d 0d 65 78 | 74 65 72 6e 20 63 68 61 |er>>=.ex|tern cha|
|000008a0| 72 20 61 74 5f 73 69 67 | 6e 3b 20 20 20 20 20 20 |r at_sig|n; |
|000008b0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 2f 2a | | /*|
|000008c0| 20 74 68 65 20 61 74 20 | 73 69 67 6e 20 2a 2f 0d | the at |sign */.|
|000008d0| 40 0d 48 65 72 65 27 73 | 20 68 6f 77 20 77 65 20 |@.Here's| how we |
|000008e0| 72 65 63 6f 67 6e 69 7a | 65 20 74 68 65 20 73 74 |recogniz|e the st|
|000008f0| 61 72 74 20 6f 66 20 61 | 20 64 6f 63 75 6d 65 6e |art of a| documen|
|00000900| 74 61 74 69 6f 6e 20 63 | 68 75 6e 6b 2c 20 61 6e |tation c|hunk, an|
|00000910| 64 0d 65 78 74 72 61 63 | 74 20 74 68 65 20 66 69 |d.extrac|t the fi|
|00000920| 72 73 74 20 6c 69 6e 65 | 20 6f 66 20 64 6f 63 75 |rst line| of docu|
|00000930| 6d 65 6e 74 61 74 69 6f | 6e 20 66 72 6f 6d 20 77 |mentatio|n from w|
|00000940| 68 61 74 20 66 6f 6c 6c | 6f 77 73 20 74 68 65 20 |hat foll|ows the |
|00000950| 40 20 73 69 67 6e 2e 0d | 3c 3c 68 65 61 64 65 72 |@ sign..|<<header|
|00000960| 3e 3e 3d 0d 69 6e 74 20 | 73 74 61 72 74 73 5f 64 |>>=.int |starts_d|
|00000970| 6f 63 28 63 68 61 72 20 | 2a 29 3b 0d 63 68 61 72 |oc(char |*);.char|
|00000980| 20 2a 66 69 72 73 74 5f | 64 6f 63 5f 6c 69 6e 65 | *first_|doc_line|
|00000990| 28 63 68 61 72 20 2a 29 | 3b 0d 3c 3c 43 20 66 75 |(char *)|;.<<C fu|
|000009a0| 6e 63 74 69 6f 6e 73 3e | 3e 3d 0d 69 6e 74 20 73 |nctions>|>=.int s|
|000009b0| 74 61 72 74 73 5f 64 6f | 63 28 63 68 61 72 20 2a |tarts_do|c(char *|
|000009c0| 6c 69 6e 65 29 20 7b 0d | 20 20 20 20 72 65 74 75 |line) {.| retu|
|000009d0| 72 6e 20 28 2a 6c 69 6e | 65 3d 3d 61 74 5f 73 69 |rn (*lin|e==at_si|
|000009e0| 67 6e 20 26 26 20 28 6c | 69 6e 65 5b 31 5d 3d 3d |gn && (l|ine[1]==|
|000009f0| 27 5c 30 27 20 7c 7c 20 | 69 73 73 70 61 63 65 28 |'\0' || |isspace(|
|00000a00| 6c 69 6e 65 5b 31 5d 29 | 29 29 3b 0d 7d 0d 0d 63 |line[1])|));.}..c|
|00000a10| 68 61 72 20 2a 66 69 72 | 73 74 5f 64 6f 63 5f 6c |har *fir|st_doc_l|
|00000a20| 69 6e 65 28 63 68 61 72 | 20 2a 6c 69 6e 65 29 20 |ine(char| *line) |
|00000a30| 7b 0d 20 20 20 20 69 66 | 20 28 6c 69 6e 65 5b 31 |{. if| (line[1|
|00000a40| 5d 21 3d 27 5c 30 27 20 | 26 26 20 6c 69 6e 65 5b |]!='\0' |&& line[|
|00000a50| 31 5d 20 21 3d 27 5c 6e | 27 29 20 72 65 74 75 72 |1] !='\n|') retur|
|00000a60| 6e 20 6c 69 6e 65 2b 32 | 3b 0d 20 20 20 20 65 6c |n line+2|;. el|
|00000a70| 73 65 20 72 65 74 75 72 | 6e 20 6c 69 6e 65 2b 31 |se retur|n line+1|
|00000a80| 3b 0d 7d 0d 40 20 25 64 | 65 66 20 73 74 61 72 74 |;.}.@ %d|ef start|
|00000a90| 73 5f 64 6f 63 20 66 69 | 72 73 74 5f 64 6f 63 5f |s_doc fi|rst_doc_|
|00000aa0| 6c 69 6e 65 0d 41 6e 20 | 69 6e 64 65 78 20 6c 69 |line.An |index li|
|00000ab0| 6e 65 20 69 73 20 61 20 | 73 70 65 63 69 61 6c 20 |ne is a |special |
|00000ac0| 63 61 73 65 20 6f 66 20 | 73 74 61 72 74 69 6e 67 |case of |starting|
|00000ad0| 20 64 6f 63 75 6d 65 6e | 74 61 74 69 6f 6e 2e 0d | documen|tation..|
|00000ae0| 3c 3c 68 65 61 64 65 72 | 3e 3e 3d 0d 69 6e 74 20 |<<header|>>=.int |
|00000af0| 69 73 5f 64 65 66 28 63 | 68 61 72 20 2a 29 3b 0d |is_def(c|har *);.|
|00000b00| 63 68 61 72 20 2a 72 65 | 6d 6f 76 65 5f 64 65 66 |char *re|move_def|
|00000b10| 5f 6d 61 72 6b 65 72 28 | 63 68 61 72 20 2a 29 3b |_marker(|char *);|
|00000b20| 0d 3c 3c 64 61 74 61 20 | 64 65 66 69 6e 69 74 69 |.<<data |definiti|
|00000b30| 6f 6e 73 3e 3e 3d 0d 73 | 74 61 74 69 63 20 63 68 |ons>>=.s|tatic ch|
|00000b40| 61 72 20 64 65 66 5f 6d | 61 72 6b 65 72 5b 5d 20 |ar def_m|arker[] |
|00000b50| 3d 20 22 20 25 64 65 66 | 20 22 3b 0d 23 64 65 66 |= " %def| ";.#def|
|00000b60| 69 6e 65 20 64 65 66 5f | 6c 65 6e 67 74 68 20 28 |ine def_|length (|
|00000b70| 36 29 0d 3c 3c 43 20 66 | 75 6e 63 74 69 6f 6e 73 |6).<<C f|unctions|
|00000b80| 3e 3e 3d 0d 69 6e 74 20 | 69 73 5f 64 65 66 28 63 |>>=.int |is_def(c|
|00000b90| 68 61 72 20 2a 6c 69 6e | 65 29 20 7b 0d 20 20 20 |har *lin|e) {. |
|00000ba0| 20 3c 3c 66 69 72 73 74 | 20 74 69 6d 65 20 74 68 | <<first| time th|
|00000bb0| 72 6f 75 67 68 2c 20 61 | 73 73 65 72 74 20 77 65 |rough, a|ssert we|
|00000bc0| 20 67 6f 74 20 74 68 65 | 20 6c 65 6e 67 74 68 20 | got the| length |
|00000bd0| 72 69 67 68 74 3e 3e 0d | 20 20 20 20 72 65 74 75 |right>>.| retu|
|00000be0| 72 6e 20 28 2a 6c 69 6e | 65 3d 3d 61 74 5f 73 69 |rn (*lin|e==at_si|
|00000bf0| 67 6e 20 26 26 20 21 73 | 74 72 6e 63 6d 70 28 6c |gn && !s|trncmp(l|
|00000c00| 69 6e 65 2b 31 2c 20 64 | 65 66 5f 6d 61 72 6b 65 |ine+1, d|ef_marke|
|00000c10| 72 2c 20 64 65 66 5f 6c | 65 6e 67 74 68 29 29 3b |r, def_l|ength));|
|00000c20| 0d 7d 0d 0d 63 68 61 72 | 20 2a 72 65 6d 6f 76 65 |.}..char| *remove|
|00000c30| 5f 64 65 66 5f 6d 61 72 | 6b 65 72 28 63 68 61 72 |_def_mar|ker(char|
|00000c40| 20 2a 6c 69 6e 65 29 20 | 7b 0d 20 20 20 20 72 65 | *line) |{. re|
|00000c50| 74 75 72 6e 20 6c 69 6e | 65 2b 31 2b 64 65 66 5f |turn lin|e+1+def_|
|00000c60| 6c 65 6e 67 74 68 3b 0d | 7d 0d 3c 3c 66 69 72 73 |length;.|}.<<firs|
|00000c70| 74 20 74 69 6d 65 20 74 | 68 72 6f 75 67 68 2c 20 |t time t|hrough, |
|00000c80| 61 73 73 65 72 74 20 77 | 65 20 67 6f 74 20 74 68 |assert w|e got th|
|00000c90| 65 20 6c 65 6e 67 74 68 | 20 72 69 67 68 74 3e 3e |e length| right>>|
|00000ca0| 3d 0d 7b 20 73 74 61 74 | 69 63 20 69 6e 74 20 63 |=.{ stat|ic int c|
|00000cb0| 68 65 63 6b 65 64 20 3d | 20 30 3b 0d 20 20 69 66 |hecked =| 0;. if|
|00000cc0| 20 28 21 63 68 65 63 6b | 65 64 29 20 7b 0d 20 20 | (!check|ed) {. |
|00000cd0| 20 20 61 73 73 65 72 74 | 28 73 74 72 6c 65 6e 28 | assert|(strlen(|
|00000ce0| 64 65 66 5f 6d 61 72 6b | 65 72 29 20 3d 3d 20 64 |def_mark|er) == d|
|00000cf0| 65 66 5f 6c 65 6e 67 74 | 68 29 3b 0d 20 20 20 20 |ef_lengt|h);. |
|00000d00| 63 68 65 63 6b 65 64 20 | 3d 20 31 3b 0d 20 20 7d |checked |= 1;. }|
|00000d10| 0d 7d 0d 40 20 25 64 65 | 66 20 69 73 5f 64 65 66 |.}.@ %de|f is_def|
|00000d20| 20 72 65 6d 6f 76 65 5f | 64 65 66 5f 6d 61 72 6b | remove_|def_mark|
|00000d30| 65 72 0d 52 65 63 6f 67 | 6e 69 7a 69 6e 67 20 6d |er.Recog|nizing m|
|00000d40| 6f 64 75 6c 65 20 6e 61 | 6d 65 73 20 28 77 68 69 |odule na|mes (whi|
|00000d50| 63 68 20 69 6e 74 72 6f | 64 75 63 65 20 63 6f 64 |ch intro|duce cod|
|00000d60| 65 20 63 68 75 6e 6b 73 | 29 0d 61 6e 64 20 65 78 |e chunks|).and ex|
|00000d70| 74 72 61 63 74 69 6e 67 | 20 74 68 65 6d 20 69 73 |tracting| them is|
|00000d80| 20 74 68 65 20 6d 69 73 | 73 69 6f 6e 20 6f 66 20 | the mis|sion of |
|00000d90| 74 68 65 20 5b 5b 6d 6f | 64 5f 73 74 61 72 74 5d |the [[mo|d_start]|
|00000da0| 5d 20 61 6e 64 20 5b 5b | 6d 6f 64 5f 65 6e 64 5d |] and [[|mod_end]|
|00000db0| 5d 0d 66 75 6e 63 74 69 | 6f 6e 73 2e 0d 0d 54 68 |].functi|ons...Th|
|00000dc0| 65 20 62 61 73 69 63 20 | 69 64 65 61 20 69 73 20 |e basic |idea is |
|00000dd0| 74 6f 20 66 69 6e 64 20 | 61 6e 20 69 6e 73 74 61 |to find |an insta|
|00000de0| 6e 63 65 20 6f 66 20 5b | 5b 40 3c 3c 5d 5d 2c 20 |nce of [|[@<<]], |
|00000df0| 77 68 69 6c 65 20 73 6b | 69 70 70 69 6e 67 20 65 |while sk|ipping e|
|00000e00| 76 65 72 79 0d 69 6e 73 | 74 61 6e 63 65 20 6f 66 |very.ins|tance of|
|00000e10| 20 5b 5b 40 40 3c 3c 5d | 5d 2e 0d 54 68 61 74 27 | [[@@<<]|]..That'|
|00000e20| 73 20 74 68 65 20 73 74 | 61 72 74 20 6f 66 20 61 |s the st|art of a|
|00000e30| 20 6d 6f 64 75 6c 65 20 | 6e 61 6d 65 2e 0d 57 65 | module |name..We|
|00000e40| 20 66 69 6e 64 20 74 68 | 65 20 65 6e 64 20 74 68 | find th|e end th|
|00000e50| 65 20 73 61 6d 65 20 77 | 61 79 2e 0d 41 20 66 75 |e same w|ay..A fu|
|00000e60| 6e 63 74 69 6f 6e 20 63 | 61 6c 6c 65 64 20 5b 5b |nction c|alled [[|
|00000e70| 66 69 6e 64 5f 65 73 63 | 61 70 65 64 5d 5d 20 64 |find_esc|aped]] d|
|00000e80| 6f 65 73 20 74 68 65 20 | 64 69 72 74 79 20 77 6f |oes the |dirty wo|
|00000e90| 72 6b 2e 0d 49 66 20 69 | 74 20 73 75 63 63 65 65 |rk..If i|t succee|
|00000ea0| 64 73 2c 20 69 74 20 72 | 65 74 75 72 6e 73 20 61 |ds, it r|eturns a|
|00000eb0| 20 70 6f 69 6e 74 65 72 | 20 74 6f 20 74 68 65 20 | pointer| to the |
|00000ec0| 66 69 72 73 74 20 63 68 | 61 72 61 63 74 65 72 20 |first ch|aracter |
|00000ed0| 61 66 74 65 72 0d 74 68 | 65 20 73 70 65 63 69 61 |after.th|e specia|
|00000ee0| 6c 20 73 65 71 75 65 6e | 63 65 2c 20 69 6e 20 74 |l sequen|ce, in t|
|00000ef0| 68 69 73 20 63 61 73 65 | 20 74 68 65 20 66 69 72 |his case| the fir|
|00000f00| 73 74 20 63 68 61 72 61 | 63 74 65 72 20 6f 66 20 |st chara|cter of |
|00000f10| 74 68 65 0d 6d 6f 64 75 | 6c 65 20 6e 61 6d 65 2e |the.modu|le name.|
|00000f20| 0d 28 49 66 20 69 74 20 | 66 61 69 6c 73 2c 20 69 |.(If it |fails, i|
|00000f30| 74 20 72 65 74 75 72 6e | 73 20 61 20 6e 75 6c 6c |t return|s a null|
|00000f40| 20 70 6f 69 6e 74 65 72 | 2e 29 0d 49 66 20 69 74 | pointer|.).If it|
|00000f50| 73 20 5b 5b 6d 61 72 6b | 5d 5d 20 70 61 72 61 6d |s [[mark|]] param|
|00000f60| 74 65 72 20 69 73 20 73 | 65 74 2c 20 69 74 20 77 |ter is s|et, it w|
|00000f70| 69 6c 6c 20 70 75 74 20 | 61 20 5b 5b 27 5c 30 27 |ill put |a [['\0'|
|00000f80| 5d 5d 20 69 6e 20 70 6c | 61 63 65 0d 6f 66 20 74 |]] in pl|ace.of t|
|00000f90| 68 65 20 73 70 65 63 69 | 61 6c 20 73 65 71 75 65 |he speci|al seque|
|00000fa0| 6e 63 65 2c 20 73 70 6c | 69 74 74 69 6e 67 20 74 |nce, spl|itting t|
|00000fb0| 68 65 20 73 74 72 69 6e | 67 20 69 6e 74 6f 20 70 |he strin|g into p|
|00000fc0| 69 65 63 65 73 2e 0d 54 | 68 65 73 65 20 74 77 6f |ieces..T|hese two|
|00000fd0| 20 70 72 6f 70 65 72 74 | 69 65 73 20 6d 61 6b 65 | propert|ies make|
|00000fe0| 20 69 74 20 70 65 72 66 | 65 63 74 20 66 6f 72 20 | it perf|ect for |
|00000ff0| 64 69 73 73 65 63 74 69 | 6e 67 20 6c 69 6e 65 73 |dissecti|ng lines|
|00001000| 20 77 69 74 68 20 6d 6f | 64 75 6c 65 20 6e 61 6d | with mo|dule nam|
|00001010| 65 73 2e 0d 0d 5b 5b 6d | 6f 64 5f 73 74 61 72 74 |es...[[m|od_start|
|00001020| 5d 5d 20 61 6e 64 20 5b | 5b 6d 6f 64 5f 65 6e 64 |]] and [|[mod_end|
|00001030| 5d 5d 20 6a 75 73 74 20 | 73 74 6f 72 65 20 74 68 |]] just |store th|
|00001040| 65 20 73 70 65 63 69 61 | 6c 20 73 65 71 75 65 6e |e specia|l sequen|
|00001050| 63 65 73 2e 0d 3c 3c 68 | 65 61 64 65 72 3e 3e 3d |ces..<<h|eader>>=|
|00001060| 0d 63 68 61 72 20 2a 6d | 6f 64 5f 73 74 61 72 74 |.char *m|od_start|
|00001070| 20 28 63 68 61 72 20 2a | 73 2c 20 69 6e 74 20 6d | (char *|s, int m|
|00001080| 61 72 6b 29 3b 20 20 20 | 20 2f 2a 20 66 69 6e 64 |ark); | /* find|
|00001090| 20 74 68 65 20 66 69 72 | 73 74 20 6d 6f 64 75 6c | the fir|st modul|
|000010a0| 65 20 6e 61 6d 65 20 2a | 2f 0d 63 68 61 72 20 2a |e name *|/.char *|
|000010b0| 6d 6f 64 5f 65 6e 64 20 | 28 63 68 61 72 20 2a 73 |mod_end |(char *s|
|000010c0| 2c 20 69 6e 74 20 6d 61 | 72 6b 29 3b 20 20 20 20 |, int ma|rk); |
|000010d0| 20 20 20 20 20 20 20 20 | 20 20 2f 2a 20 66 69 6e | | /* fin|
|000010e0| 64 20 74 68 65 20 65 6e | 64 20 6f 66 20 6d 6f 64 |d the en|d of mod|
|000010f0| 75 6c 65 20 6e 61 6d 65 | 20 2a 2f 0d 3c 3c 43 20 |ule name| */.<<C |
|00001100| 66 75 6e 63 74 69 6f 6e | 73 3e 3e 3d 0d 63 68 61 |function|s>>=.cha|
|00001110| 72 20 2a 6d 6f 64 5f 73 | 74 61 72 74 28 63 68 61 |r *mod_s|tart(cha|
|00001120| 72 20 2a 73 2c 20 69 6e | 74 20 6d 61 72 6b 29 20 |r *s, in|t mark) |
|00001130| 7b 0d 20 20 20 20 72 65 | 74 75 72 6e 20 66 69 6e |{. re|turn fin|
|00001140| 64 5f 65 73 63 61 70 65 | 64 28 73 2c 22 40 3c 3c |d_escape|d(s,"@<<|
|00001150| 22 2c 22 40 40 3c 3c 22 | 2c 20 6d 61 72 6b 29 3b |","@@<<"|, mark);|
|00001160| 0d 7d 0d 63 68 61 72 20 | 2a 6d 6f 64 5f 65 6e 64 |.}.char |*mod_end|
|00001170| 28 63 68 61 72 20 2a 73 | 2c 20 69 6e 74 20 6d 61 |(char *s|, int ma|
|00001180| 72 6b 29 20 7b 0d 20 20 | 20 20 72 65 74 75 72 6e |rk) {. | return|
|00001190| 20 66 69 6e 64 5f 65 73 | 63 61 70 65 64 28 73 2c | find_es|caped(s,|
|000011a0| 22 40 3e 3e 22 2c 22 40 | 40 3e 3e 22 2c 20 6d 61 |"@>>","@|@>>", ma|
|000011b0| 72 6b 29 3b 0d 7d 0d 40 | 20 25 64 65 66 20 6d 6f |rk);.}.@| %def mo|
|000011c0| 64 5f 73 74 61 72 74 20 | 6d 6f 64 5f 65 6e 64 0d |d_start |mod_end.|
|000011d0| 4f 6e 63 65 20 77 65 20 | 6b 6e 6f 77 20 68 6f 77 |Once we |know how|
|000011e0| 20 74 6f 20 5b 5b 6d 6f | 64 5f 73 74 61 72 74 5d | to [[mo|d_start]|
|000011f0| 5d 20 61 6e 64 20 5b 5b | 6d 6f 64 5f 65 6e 64 5d |] and [[|mod_end]|
|00001200| 5d 2c 20 72 65 63 6f 67 | 6e 69 7a 69 6e 67 20 74 |], recog|nizing t|
|00001210| 68 65 0d 62 65 67 69 6e | 6e 69 6e 67 20 6f 66 20 |he.begin|ning of |
|00001220| 61 20 63 6f 64 65 20 63 | 68 75 6e 6b 20 69 73 20 |a code c|hunk is |
|00001230| 65 61 73 79 2e 0d 3c 3c | 68 65 61 64 65 72 3e 3e |easy..<<|header>>|
|00001240| 3d 0d 69 6e 74 20 73 74 | 61 72 74 73 5f 63 6f 64 |=.int st|arts_cod|
|00001250| 65 20 28 63 68 61 72 20 | 2a 6c 69 6e 65 2c 20 63 |e (char |*line, c|
|00001260| 68 61 72 20 2a 66 69 6c | 65 6e 61 6d 65 2c 20 69 |har *fil|ename, i|
|00001270| 6e 74 20 6c 69 6e 65 6e | 6f 29 3b 20 20 0d 09 09 |nt linen|o); ...|
|00001280| 09 09 20 20 20 20 20 20 | 20 20 2f 2a 20 64 6f 65 |.. | /* doe|
|00001290| 73 20 74 68 69 73 20 6c | 69 6e 65 20 73 74 61 72 |s this l|ine star|
|000012a0| 74 20 6d 6f 64 75 6c 65 | 20 64 65 66 6e 3f 20 2a |t module| defn? *|
|000012b0| 2f 0d 76 6f 69 64 20 67 | 65 74 6d 6f 64 6e 61 6d |/.void g|etmodnam|
|000012c0| 65 28 63 68 61 72 20 2a | 64 65 73 74 2c 20 69 6e |e(char *|dest, in|
|000012d0| 74 20 73 69 7a 65 2c 20 | 63 68 61 72 20 2a 73 6f |t size, |char *so|
|000012e0| 75 72 63 65 29 3b 0d 20 | 20 20 20 20 20 20 20 20 |urce);. | |
|000012f0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001300| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 2f | | /|
|00001310| 2a 20 65 78 74 72 61 63 | 74 20 6d 6f 64 75 6c 65 |* extrac|t module|
|00001320| 20 6e 61 6d 65 20 61 6e | 64 20 70 75 74 20 69 6e | name an|d put in|
|00001330| 20 64 65 73 74 20 2a 2f | 0d 3c 3c 43 20 66 75 6e | dest */|.<<C fun|
|00001340| 63 74 69 6f 6e 73 3e 3e | 3d 0d 69 6e 74 20 73 74 |ctions>>|=.int st|
|00001350| 61 72 74 73 5f 63 6f 64 | 65 20 28 63 68 61 72 20 |arts_cod|e (char |
|00001360| 2a 6c 69 6e 65 2c 20 63 | 68 61 72 20 2a 66 69 6c |*line, c|har *fil|
|00001370| 65 6e 61 6d 65 2c 20 69 | 6e 74 20 6c 69 6e 65 6e |ename, i|nt linen|
|00001380| 6f 29 20 7b 0d 20 20 20 | 20 63 68 61 72 20 2a 74 |o) {. | char *t|
|00001390| 61 69 6c 3b 0d 20 20 20 | 20 69 66 20 28 6d 6f 64 |ail;. | if (mod|
|000013a0| 5f 73 74 61 72 74 28 6c | 69 6e 65 2c 30 29 20 21 |_start(l|ine,0) !|
|000013b0| 3d 20 6c 69 6e 65 2b 32 | 29 20 72 65 74 75 72 6e |= line+2|) return|
|000013c0| 20 30 3b 0d 20 20 20 20 | 74 61 69 6c 20 3d 20 6d | 0;. |tail = m|
|000013d0| 6f 64 5f 65 6e 64 28 6c | 69 6e 65 2b 32 2c 30 29 |od_end(l|ine+2,0)|
|000013e0| 3b 0d 20 20 20 20 69 66 | 20 28 74 61 69 6c 20 3d |;. if| (tail =|
|000013f0| 3d 20 4e 55 4c 4c 29 20 | 3c 3c 65 72 72 6f 72 20 |= NULL) |<<error |
|00001400| 65 78 69 74 20 66 72 6f | 6d 20 5b 5b 73 74 61 72 |exit fro|m [[star|
|00001410| 74 73 5f 63 6f 64 65 5d | 5d 3e 3e 0d 20 20 20 20 |ts_code]|]>>. |
|00001420| 69 66 20 28 2a 74 61 69 | 6c 2b 2b 20 21 3d 20 27 |if (*tai|l++ != '|
|00001430| 3d 27 29 20 72 65 74 75 | 72 6e 20 30 3b 0d 20 20 |=') retu|rn 0;. |
|00001440| 20 20 77 68 69 6c 65 20 | 28 69 73 73 70 61 63 65 | while |(isspace|
|00001450| 28 2a 74 61 69 6c 29 29 | 20 74 61 69 6c 2b 2b 3b |(*tail))| tail++;|
|00001460| 0d 20 20 20 20 72 65 74 | 75 72 6e 20 28 2a 74 61 |. ret|urn (*ta|
|00001470| 69 6c 20 3d 3d 20 27 5c | 30 27 29 3b 0d 7d 0d 0d |il == '\|0');.}..|
|00001480| 76 6f 69 64 20 67 65 74 | 6d 6f 64 6e 61 6d 65 28 |void get|modname(|
|00001490| 63 68 61 72 20 2a 64 65 | 73 74 2c 20 69 6e 74 20 |char *de|st, int |
|000014a0| 73 69 7a 65 2c 20 63 68 | 61 72 20 2a 73 6f 75 72 |size, ch|ar *sour|
|000014b0| 63 65 29 20 7b 0d 20 20 | 20 20 2f 2a 20 65 78 63 |ce) {. | /* exc|
|000014c0| 65 73 73 20 63 68 61 72 | 61 63 74 65 72 73 20 69 |ess char|acters i|
|000014d0| 6e 20 74 68 65 20 6d 6f | 64 75 6c 65 20 6e 61 6d |n the mo|dule nam|
|000014e0| 65 20 61 72 65 20 69 67 | 6e 6f 72 65 64 20 2a 2f |e are ig|nored */|
|000014f0| 0d 20 20 20 20 63 68 61 | 72 20 2a 70 20 3d 20 73 |. cha|r *p = s|
|00001500| 74 72 73 61 76 65 28 73 | 6f 75 72 63 65 29 3b 0d |trsave(s|ource);.|
|00001510| 20 20 20 20 63 68 61 72 | 20 2a 71 20 3d 20 6d 6f | char| *q = mo|
|00001520| 64 5f 73 74 61 72 74 28 | 70 2c 31 29 3b 0d 0d 20 |d_start(|p,1);.. |
|00001530| 20 20 20 69 66 20 28 71 | 3d 3d 4e 55 4c 4c 29 20 | if (q|==NULL) |
|00001540| 3c 3c 45 72 72 6f 72 20 | 65 78 69 74 20 66 72 6f |<<Error |exit fro|
|00001550| 6d 20 67 65 74 6d 6f 64 | 6e 61 6d 65 3e 3e 0d 20 |m getmod|name>>. |
|00001560| 20 20 20 69 66 20 28 6d | 6f 64 5f 65 6e 64 28 71 | if (m|od_end(q|
|00001570| 2c 31 29 3d 3d 4e 55 4c | 4c 29 20 3c 3c 45 72 72 |,1)==NUL|L) <<Err|
|00001580| 6f 72 20 65 78 69 74 20 | 66 72 6f 6d 20 67 65 74 |or exit |from get|
|00001590| 6d 6f 64 6e 61 6d 65 3e | 3e 0d 20 20 20 20 73 74 |modname>|>. st|
|000015a0| 72 6e 63 70 79 28 64 65 | 73 74 2c 71 2c 73 69 7a |rncpy(de|st,q,siz|
|000015b0| 65 2d 31 29 3b 0d 20 20 | 20 20 64 65 73 74 5b 73 |e-1);. | dest[s|
|000015c0| 69 7a 65 2d 31 5d 20 3d | 20 27 5c 30 27 3b 0d 20 |ize-1] =| '\0';. |
|000015d0| 20 20 20 66 72 65 65 28 | 70 29 3b 0d 7d 0d 40 20 | free(|p);.}.@ |
|000015e0| 25 64 65 66 20 73 74 61 | 72 74 73 5f 63 6f 64 65 |%def sta|rts_code|
|000015f0| 20 67 65 74 6d 6f 64 6e | 61 6d 65 0d 3c 3c 65 72 | getmodn|ame.<<er|
|00001600| 72 6f 72 20 65 78 69 74 | 20 66 72 6f 6d 20 5b 5b |ror exit| from [[|
|00001610| 73 74 61 72 74 73 5f 63 | 6f 64 65 5d 5d 3e 3e 3d |starts_c|ode]]>>=|
|00001620| 0d 7b 0d 20 20 20 20 65 | 72 72 6f 72 61 74 28 66 |.{. e|rrorat(f|
|00001630| 69 6c 65 6e 61 6d 65 2c | 20 6c 69 6e 65 6e 6f 2c |ilename,| lineno,|
|00001640| 20 45 72 72 6f 72 2c 20 | 22 4d 6f 64 75 6c 65 20 | Error, |"Module |
|00001650| 6e 61 6d 65 20 64 6f 65 | 73 6e 27 74 20 65 6e 64 |name doe|sn't end|
|00001660| 22 2c 20 6c 69 6e 65 29 | 3b 0d 20 20 20 20 72 65 |", line)|;. re|
|00001670| 74 75 72 6e 20 30 3b 0d | 7d 0d 3c 3c 45 72 72 6f |turn 0;.|}.<<Erro|
|00001680| 72 20 65 78 69 74 20 66 | 72 6f 6d 20 67 65 74 6d |r exit f|rom getm|
|00001690| 6f 64 6e 61 6d 65 3e 3e | 3d 20 0d 7b 0d 20 20 20 |odname>>|= .{. |
|000016a0| 20 66 72 65 65 28 70 29 | 3b 0d 20 20 20 20 69 6d | free(p)|;. im|
|000016b0| 70 6f 73 73 69 62 6c 65 | 0d 20 20 20 20 20 20 20 |possible|. |
|000016c0| 20 28 22 49 20 63 6f 75 | 6c 64 6e 27 74 20 6d 61 | ("I cou|ldn't ma|
|000016d0| 6e 61 67 65 20 74 6f 20 | 65 78 74 72 61 63 74 20 |nage to |extract |
|000016e0| 61 20 6d 6f 64 75 6c 65 | 20 6e 61 6d 65 2c 20 62 |a module| name, b|
|000016f0| 75 74 20 49 27 6d 20 73 | 75 72 65 20 49 20 73 61 |ut I'm s|ure I sa|
|00001700| 77 20 6f 6e 65 22 29 3b | 0d 7d 0d 40 0d 46 69 6e |w one");|.}.@.Fin|
|00001710| 64 69 6e 67 20 63 6f 64 | 65 2d 71 75 6f 74 69 6e |ding cod|e-quotin|
|00001720| 67 20 62 72 61 63 6b 65 | 74 73 20 69 73 20 61 20 |g bracke|ts is a |
|00001730| 73 69 6d 70 6c 65 20 61 | 70 70 6c 69 63 61 74 69 |simple a|pplicati|
|00001740| 6f 6e 20 6f 66 20 0d 5b | 5b 66 69 6e 64 5f 65 73 |on of .[|[find_es|
|00001750| 63 61 70 65 64 5d 5d 2e | 0d 3c 3c 68 65 61 64 65 |caped]].|.<<heade|
|00001760| 72 3e 3e 3d 0d 63 68 61 | 72 20 2a 71 75 6f 74 65 |r>>=.cha|r *quote|
|00001770| 5f 73 74 61 72 74 20 28 | 63 68 61 72 20 2a 73 2c |_start (|char *s,|
|00001780| 20 69 6e 74 20 6d 61 72 | 6b 29 3b 20 20 20 20 2f | int mar|k); /|
|00001790| 2a 20 66 69 6e 64 20 6f | 70 65 6e 20 63 6f 64 65 |* find o|pen code|
|000017a0| 20 71 75 6f 74 65 20 28 | 5b 5b 29 20 2a 2f 0d 63 | quote (|[[) */.c|
|000017b0| 68 61 72 20 2a 71 75 6f | 74 65 5f 65 6e 64 20 28 |har *quo|te_end (|
|000017c0| 63 68 61 72 20 2a 73 2c | 20 69 6e 74 20 6d 61 72 |char *s,| int mar|
|000017d0| 6b 29 3b 20 20 20 20 20 | 20 2f 2a 20 66 69 6e 64 |k); | /* find|
|000017e0| 20 63 6c 6f 73 65 20 63 | 6f 64 65 20 71 75 6f 74 | close c|ode quot|
|000017f0| 65 20 28 5d 5d 29 20 2a | 2f 0d 3c 3c 43 20 66 75 |e (]]) *|/.<<C fu|
|00001800| 6e 63 74 69 6f 6e 73 3e | 3e 3d 0d 63 68 61 72 20 |nctions>|>=.char |
|00001810| 2a 71 75 6f 74 65 5f 73 | 74 61 72 74 28 63 68 61 |*quote_s|tart(cha|
|00001820| 72 20 2a 73 2c 20 69 6e | 74 20 6d 61 72 6b 29 20 |r *s, in|t mark) |
|00001830| 7b 0d 20 20 20 20 72 65 | 74 75 72 6e 20 66 69 6e |{. re|turn fin|
|00001840| 64 5f 65 73 63 61 70 65 | 64 28 73 2c 22 5b 5b 22 |d_escape|d(s,"[["|
|00001850| 2c 4e 55 4c 4c 2c 20 6d | 61 72 6b 29 3b 0d 7d 0d |,NULL, m|ark);.}.|
|00001860| 40 20 25 64 65 66 20 71 | 75 6f 74 65 5f 73 74 61 |@ %def q|uote_sta|
|00001870| 72 74 0d 54 6f 20 66 69 | 6e 64 20 74 68 65 20 65 |rt.To fi|nd the e|
|00001880| 6e 64 20 6f 66 20 61 20 | 71 75 6f 74 65 2c 20 49 |nd of a |quote, I|
|00001890| 20 6d 75 73 74 20 74 61 | 6b 65 20 74 68 65 20 6c | must ta|ke the l|
|000018a0| 61 73 74 20 70 61 69 72 | 20 69 6e 20 61 20 73 65 |ast pair| in a se|
|000018b0| 72 69 65 73 20 6f 66 0d | 74 77 6f 20 6f 72 20 6d |ries of.|two or m|
|000018c0| 6f 72 65 20 72 69 67 68 | 74 20 62 72 61 63 6b 65 |ore righ|t bracke|
|000018d0| 74 73 2e 0d 3c 3c 43 20 | 66 75 6e 63 74 69 6f 6e |ts..<<C |function|
|000018e0| 73 3e 3e 3d 0d 63 68 61 | 72 20 2a 71 75 6f 74 65 |s>>=.cha|r *quote|
|000018f0| 5f 65 6e 64 28 63 68 61 | 72 20 2a 73 2c 20 69 6e |_end(cha|r *s, in|
|00001900| 74 20 6d 61 72 6b 29 20 | 7b 0d 20 20 20 20 63 68 |t mark) |{. ch|
|00001910| 61 72 20 2a 74 20 3d 20 | 66 69 6e 64 5f 65 73 63 |ar *t = |find_esc|
|00001920| 61 70 65 64 28 73 2c 20 | 22 5d 5d 22 2c 20 4e 55 |aped(s, |"]]", NU|
|00001930| 4c 4c 2c 20 30 29 3b 0d | 20 20 20 20 69 66 20 28 |LL, 0);.| if (|
|00001940| 74 20 3d 3d 20 4e 55 4c | 4c 29 20 0d 20 20 20 20 |t == NUL|L) . |
|00001950| 20 20 20 20 72 65 74 75 | 72 6e 20 74 3b 0d 20 20 | retu|rn t;. |
|00001960| 20 20 65 6c 73 65 20 7b | 0d 09 74 20 2d 3d 20 32 | else {|..t -= 2|
|00001970| 3b 09 09 2f 2a 20 73 75 | 62 74 72 61 63 74 20 6c |;../* su|btract l|
|00001980| 65 6e 67 74 68 20 6f 66 | 20 5d 5d 20 2a 2f 0d 20 |ength of| ]] */. |
|00001990| 20 20 20 20 20 20 20 61 | 73 73 65 72 74 28 74 5b | a|ssert(t[|
|000019a0| 30 5d 20 3d 3d 20 27 5d | 27 20 26 26 20 74 5b 31 |0] == ']|' && t[1|
|000019b0| 5d 20 3d 3d 20 27 5d 27 | 29 3b 0d 20 20 20 20 20 |] == ']'|);. |
|000019c0| 20 20 20 77 68 69 6c 65 | 20 28 74 5b 32 5d 20 3d | while| (t[2] =|
|000019d0| 3d 20 27 5d 27 29 20 74 | 2b 2b 3b 0d 20 20 20 20 |= ']') t|++;. |
|000019e0| 20 20 20 20 61 73 73 65 | 72 74 28 74 5b 30 5d 20 | asse|rt(t[0] |
|000019f0| 3d 3d 20 27 5d 27 20 26 | 26 20 74 5b 31 5d 20 3d |== ']' &|& t[1] =|
|00001a00| 3d 20 27 5d 27 29 3b 0d | 20 20 20 20 20 20 20 20 |= ']');.| |
|00001a10| 69 66 20 28 6d 61 72 6b | 29 20 2a 74 20 3d 20 30 |if (mark|) *t = 0|
|00001a20| 3b 0d 09 72 65 74 75 72 | 6e 20 74 2b 32 3b 0d 20 |;..retur|n t+2;. |
|00001a30| 20 20 20 7d 0d 7d 0d 40 | 20 25 64 65 66 20 71 75 | }.}.@| %def qu|
|00001a40| 6f 74 65 5f 65 6e 64 0d | 0d 48 65 72 65 20 77 65 |ote_end.|.Here we|
|00001a50| 20 64 6f 20 74 68 65 20 | 6d 61 67 69 63 20 5b 5b | do the |magic [[|
|00001a60| 66 69 6e 64 5f 65 73 63 | 61 70 65 64 5d 5d 2e 0d |find_esc|aped]]..|
|00001a70| 46 69 6e 64 20 61 6e 20 | 61 72 62 69 74 72 61 72 |Find an |arbitrar|
|00001a80| 79 20 63 68 61 72 61 63 | 74 65 72 20 73 65 71 65 |y charac|ter seqe|
|00001a90| 6e 63 65 2c 20 73 6b 69 | 70 70 69 6e 67 20 61 6e |nce, ski|pping an|
|00001aa0| 20 65 73 63 61 70 65 64 | 20 73 65 71 75 65 6e 63 | escaped| sequenc|
|00001ab0| 65 20 28 69 66 20 61 6e | 79 29 2c 0d 72 65 70 6c |e (if an|y),.repl|
|00001ac0| 61 63 69 6e 67 20 74 68 | 65 20 62 65 67 69 6e 6e |acing th|e beginn|
|00001ad0| 69 6e 67 20 77 69 74 68 | 20 5b 5b 27 5c 30 27 5d |ing with| [['\0']|
|00001ae0| 5d 20 69 66 20 5b 5b 6d | 61 72 6b 5d 5d 20 69 73 |] if [[m|ark]] is|
|00001af0| 20 73 65 74 2e 0d 0d 20 | 49 66 20 6e 6f 20 5b 5b | set... |If no [[|
|00001b00| 73 65 61 72 63 68 5d 5d | 20 73 65 71 75 65 6e 63 |search]]| sequenc|
|00001b10| 65 20 69 6e 20 5b 5b 73 | 5d 5d 2c 20 72 65 74 75 |e in [[s|]], retu|
|00001b20| 72 6e 73 20 5b 5b 4e 55 | 4c 4c 5d 5d 2e 0d 20 20 |rns [[NU|LL]].. |
|00001b30| 20 20 20 20 4f 74 68 65 | 72 77 69 73 65 2c 20 72 | Othe|rwise, r|
|00001b40| 65 74 75 72 6e 73 20 61 | 20 70 6f 69 6e 74 65 72 |eturns a| pointer|
|00001b50| 20 74 6f 20 74 68 65 20 | 66 69 72 73 74 20 63 68 | to the |first ch|
|00001b60| 61 72 61 63 74 65 72 20 | 61 66 74 65 72 20 74 68 |aracter |after th|
|00001b70| 65 0d 20 20 20 20 20 20 | 5b 5b 73 65 61 72 63 68 |e. |[[search|
|00001b80| 5d 5d 20 73 65 71 75 65 | 6e 63 65 2c 20 61 6e 64 |]] seque|nce, and|
|00001b90| 20 73 65 74 73 20 74 68 | 65 20 66 69 72 73 74 20 | sets th|e first |
|00001ba0| 63 68 61 72 61 63 74 65 | 72 20 74 6f 20 5b 5b 27 |characte|r to [['|
|00001bb0| 5c 30 27 5d 5d 2c 20 73 | 6f 0d 20 20 20 20 20 20 |\0']], s|o. |
|00001bc0| 74 68 61 74 20 5b 5b 73 | 5d 5d 20 77 69 6c 6c 20 |that [[s|]] will |
|00001bd0| 70 6f 69 6e 74 20 74 6f | 20 74 68 65 20 70 61 72 |point to| the par|
|00001be0| 74 20 6f 66 20 74 68 65 | 20 73 74 72 69 6e 67 20 |t of the| string |
|00001bf0| 62 65 66 6f 72 65 20 74 | 68 65 20 5b 5b 73 65 61 |before t|he [[sea|
|00001c00| 72 63 68 5d 5d 0d 20 20 | 20 20 20 20 73 65 71 75 |rch]]. | sequ|
|00001c10| 65 6e 63 65 2e 20 20 54 | 68 65 20 5b 5b 65 73 63 |ence. T|he [[esc|
|00001c20| 61 70 65 5d 5d 20 73 65 | 71 75 65 6e 63 65 20 28 |ape]] se|quence (|
|00001c30| 69 66 20 61 6e 79 29 20 | 69 73 20 61 6c 77 61 79 |if any) |is alway|
|00001c40| 73 20 73 6b 69 70 70 65 | 64 2c 0d 20 20 20 20 20 |s skippe|d,. |
|00001c50| 20 65 76 65 6e 20 69 66 | 20 74 68 65 20 5b 5b 73 | even if| the [[s|
|00001c60| 65 61 72 63 68 5d 5d 20 | 73 65 71 75 65 6e 63 65 |earch]] |sequence|
|00001c70| 20 69 73 20 61 20 73 75 | 62 73 74 72 69 6e 67 20 | is a su|bstring |
|00001c80| 6f 66 20 69 74 2e 0d 0d | 5b 5b 65 73 63 61 70 65 |of it...|[[escape|
|00001c90| 5d 5d 20 77 69 6c 6c 20 | 62 65 20 69 67 6e 6f 72 |]] will |be ignor|
|00001ca0| 65 64 20 69 66 20 69 74 | 20 69 73 20 65 69 74 68 |ed if it| is eith|
|00001cb0| 65 72 20 74 68 65 20 5b | 5b 4e 55 4c 4c 5d 5d 20 |er the [|[NULL]] |
|00001cc0| 70 6f 69 6e 74 65 72 0d | 6f 72 20 74 68 65 20 6e |pointer.|or the n|
|00001cd0| 75 6c 6c 20 73 74 72 69 | 6e 67 20 28 5b 5b 22 22 |ull stri|ng ([[""|
|00001ce0| 5d 5d 29 2e 0d 3c 3c 68 | 65 61 64 65 72 3e 3e 3d |]])..<<h|eader>>=|
|00001cf0| 0d 63 68 61 72 20 2a 66 | 69 6e 64 5f 65 73 63 61 |.char *f|ind_esca|
|00001d00| 70 65 64 28 72 65 67 69 | 73 74 65 72 20 63 68 61 |ped(regi|ster cha|
|00001d10| 72 20 2a 73 2c 20 63 68 | 61 72 20 2a 73 65 61 72 |r *s, ch|ar *sear|
|00001d20| 63 68 2c 20 63 68 61 72 | 20 2a 65 73 63 61 70 65 |ch, char| *escape|
|00001d30| 2c 20 69 6e 74 20 6d 61 | 72 6b 29 3b 0d 20 20 20 |, int ma|rk);. |
|00001d40| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 2f 2a 20 | | /* |
|00001d50| 66 69 6e 64 20 65 73 63 | 61 70 65 64 20 73 74 72 |find esc|aped str|
|00001d60| 69 6e 67 73 2e 20 53 65 | 65 20 6d 61 72 6b 75 70 |ings. Se|e markup|
|00001d70| 2e 6e 77 20 66 6f 72 20 | 64 65 74 61 69 6c 73 20 |.nw for |details |
|00001d80| 2a 2f 0d 3c 3c 43 20 66 | 75 6e 63 74 69 6f 6e 73 |*/.<<C f|unctions|
|00001d90| 3e 3e 3d 0d 63 68 61 72 | 20 2a 66 69 6e 64 5f 65 |>>=.char| *find_e|
|00001da0| 73 63 61 70 65 64 28 72 | 65 67 69 73 74 65 72 20 |scaped(r|egister |
|00001db0| 63 68 61 72 20 2a 73 2c | 20 63 68 61 72 20 2a 73 |char *s,| char *s|
|00001dc0| 65 61 72 63 68 2c 20 63 | 68 61 72 20 2a 65 73 63 |earch, c|har *esc|
|00001dd0| 61 70 65 2c 20 69 6e 74 | 20 6d 61 72 6b 29 20 7b |ape, int| mark) {|
|00001de0| 0d 20 20 20 20 72 65 67 | 69 73 74 65 72 20 63 68 |. reg|ister ch|
|00001df0| 61 72 20 66 69 72 73 74 | 20 3d 20 2a 73 65 61 72 |ar first| = *sear|
|00001e00| 63 68 3b 0d 20 20 20 20 | 72 65 67 69 73 74 65 72 |ch;. |register|
|00001e10| 20 63 68 61 72 20 66 69 | 72 73 74 5f 65 73 63 61 | char fi|rst_esca|
|00001e20| 70 65 20 3d 20 28 65 73 | 63 61 70 65 20 21 3d 20 |pe = (es|cape != |
|00001e30| 4e 55 4c 4c 20 3f 20 2a | 65 73 63 61 70 65 20 3a |NULL ? *|escape :|
|00001e40| 20 27 5c 30 27 29 3b 0d | 20 20 20 20 69 6e 74 20 | '\0');.| int |
|00001e50| 73 65 61 72 63 68 6c 65 | 6e 20 3d 20 73 74 72 6c |searchle|n = strl|
|00001e60| 65 6e 28 73 65 61 72 63 | 68 29 3b 0d 20 20 20 20 |en(searc|h);. |
|00001e70| 69 6e 74 20 65 73 63 61 | 70 65 6c 65 6e 20 3d 20 |int esca|pelen = |
|00001e80| 28 65 73 63 61 70 65 20 | 21 3d 20 4e 55 4c 4c 20 |(escape |!= NULL |
|00001e90| 3f 20 73 74 72 6c 65 6e | 28 65 73 63 61 70 65 29 |? strlen|(escape)|
|00001ea0| 20 3a 20 30 29 3b 0d 0d | 20 20 20 20 64 6f 20 7b | : 0);..| do {|
|00001eb0| 0d 20 20 20 20 20 20 20 | 20 77 68 69 6c 65 20 28 |. | while (|
|00001ec0| 2a 73 20 26 26 20 2a 73 | 20 21 3d 20 66 69 72 73 |*s && *s| != firs|
|00001ed0| 74 20 26 26 20 2a 73 20 | 21 3d 20 66 69 72 73 74 |t && *s |!= first|
|00001ee0| 5f 65 73 63 61 70 65 29 | 20 73 2b 2b 3b 0d 20 20 |_escape)| s++;. |
|00001ef0| 20 20 20 20 20 20 69 66 | 20 28 21 2a 73 29 20 62 | if| (!*s) b|
|00001f00| 72 65 61 6b 3b 0d 20 20 | 20 20 20 20 20 20 69 66 |reak;. | if|
|00001f10| 20 28 66 69 72 73 74 5f | 65 73 63 61 70 65 20 26 | (first_|escape &|
|00001f20| 26 20 21 73 74 72 6e 63 | 6d 70 28 73 2c 65 73 63 |& !strnc|mp(s,esc|
|00001f30| 61 70 65 2c 65 73 63 61 | 70 65 6c 65 6e 29 29 20 |ape,esca|pelen)) |
|00001f40| 7b 0d 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |{. | |
|00001f50| 20 20 73 20 2b 3d 20 65 | 73 63 61 70 65 6c 65 6e | s += e|scapelen|
|00001f60| 3b 0d 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |;. | |
|00001f70| 20 20 63 6f 6e 74 69 6e | 75 65 3b 0d 20 20 20 20 | contin|ue;. |
|00001f80| 20 20 20 20 7d 0d 20 20 | 20 20 20 20 20 20 69 66 | }. | if|
|00001f90| 20 28 21 73 74 72 6e 63 | 6d 70 28 73 2c 73 65 61 | (!strnc|mp(s,sea|
|00001fa0| 72 63 68 2c 73 65 61 72 | 63 68 6c 65 6e 29 29 20 |rch,sear|chlen)) |
|00001fb0| 62 72 65 61 6b 3b 0d 20 | 20 20 20 20 20 20 20 73 |break;. | s|
|00001fc0| 2b 2b 3b 0d 20 20 20 20 | 7d 20 77 68 69 6c 65 20 |++;. |} while |
|00001fd0| 28 2a 73 20 21 3d 20 27 | 5c 30 27 29 3b 0d 20 20 |(*s != '|\0');. |
|00001fe0| 20 20 2f 2a 20 68 65 72 | 65 20 65 69 74 68 65 72 | /* her|e either|
|00001ff0| 20 73 20 69 73 20 65 6d | 70 74 79 20 6f 72 20 69 | s is em|pty or i|
|00002000| 74 20 70 6f 69 6e 74 73 | 20 74 6f 20 74 68 65 20 |t points| to the |
|00002010| 66 69 72 73 74 20 75 6e | 65 73 63 61 70 65 64 20 |first un|escaped |
|00002020| 5b 5b 73 65 61 72 63 68 | 5d 5d 20 2a 2f 0d 20 20 |[[search|]] */. |
|00002030| 20 20 69 66 20 28 2a 73 | 20 3d 3d 20 27 5c 30 27 | if (*s| == '\0'|
|00002040| 29 20 72 65 74 75 72 6e | 20 4e 55 4c 4c 3b 0d 20 |) return| NULL;. |
|00002050| 20 20 20 69 66 20 28 6d | 61 72 6b 29 20 2a 73 20 | if (m|ark) *s |
|00002060| 3d 20 27 5c 30 27 3b 0d | 20 20 20 20 72 65 74 75 |= '\0';.| retu|
|00002070| 72 6e 20 73 2b 73 65 61 | 72 63 68 6c 65 6e 3b 0d |rn s+sea|rchlen;.|
|00002080| 7d 0d 40 20 25 64 65 66 | 20 66 69 6e 64 5f 65 73 |}.@ %def| find_es|
|00002090| 63 61 70 65 64 0d 0d 46 | 69 6e 61 6c 6c 79 2c 20 |caped..F|inally, |
|000020a0| 68 65 72 65 20 77 69 74 | 68 20 74 68 65 20 6f 74 |here wit|h the ot|
|000020b0| 68 65 72 20 63 68 61 72 | 61 63 74 65 72 20 73 74 |her char|acter st|
|000020c0| 75 66 66 2c 20 77 65 20 | 70 75 74 20 61 20 72 6f |uff, we |put a ro|
|000020d0| 75 74 69 6e 65 20 74 6f | 0d 74 72 61 6e 73 6c 61 |utine to|.transla|
|000020e0| 74 65 20 74 68 65 20 65 | 73 63 61 70 65 20 73 65 |te the e|scape se|
|000020f0| 71 75 65 6e 63 65 73 2e | 0d 49 74 27 73 20 75 73 |quences.|.It's us|
|00002100| 65 64 20 62 79 20 7b 5c | 65 6d 20 6e 6f 74 61 6e |ed by {\|em notan|
|00002110| 67 6c 65 7d 20 61 66 74 | 65 72 20 74 68 65 20 6d |gle} aft|er the m|
|00002120| 6f 64 75 6c 65 20 6e 61 | 6d 65 73 20 68 61 76 65 |odule na|mes have|
|00002130| 20 62 65 65 6e 20 65 78 | 74 72 61 63 74 65 64 2c | been ex|tracted,|
|00002140| 0d 73 6f 20 77 65 20 63 | 61 6e 20 70 75 74 20 74 |.so we c|an put t|
|00002150| 68 69 6e 67 73 20 6c 69 | 6b 65 20 5b 5b 40 3c 3c |hings li|ke [[@<<|
|00002160| 5d 5d 20 69 6e 74 6f 20 | 70 72 6f 67 72 61 6d 20 |]] into |program |
|00002170| 73 6f 75 72 63 65 2e 0d | 41 74 20 74 68 65 20 6d |source..|At the m|
|00002180| 6f 6d 65 6e 74 2c 20 6f | 6e 6c 79 20 74 68 65 20 |oment, o|nly the |
|00002190| 6d 6f 64 75 6c 65 20 6e | 61 6d 65 20 64 65 6c 69 |module n|ame deli|
|000021a0| 6d 69 74 65 72 73 20 63 | 61 6e 20 62 65 20 65 73 |miters c|an be es|
|000021b0| 63 61 70 65 64 20 6f 72 | 20 6e 65 65 64 20 65 73 |caped or| need es|
|000021c0| 63 61 70 69 6e 67 2e 0d | 0d 5b 5b 75 6e 65 73 63 |caping..|.[[unesc|
|000021d0| 61 70 65 5d 5d 20 72 65 | 74 75 72 6e 73 20 61 20 |ape]] re|turns a |
|000021e0| 66 72 65 73 68 20 73 74 | 72 69 6e 67 2c 20 61 6c |fresh st|ring, al|
|000021f0| 6c 6f 63 61 74 65 64 20 | 77 69 74 68 20 5b 5b 6d |located |with [[m|
|00002200| 61 6c 6c 6f 63 5d 5d 2e | 0d 3c 3c 68 65 61 64 65 |alloc]].|.<<heade|
|00002210| 72 3e 3e 3d 0d 63 68 61 | 72 20 2a 75 6e 65 73 63 |r>>=.cha|r *unesc|
|00002220| 61 70 65 20 28 63 68 61 | 72 20 2a 73 29 3b 20 2f |ape (cha|r *s); /|
|00002230| 2a 20 72 65 74 75 72 6e | 73 20 66 72 65 73 68 20 |* return|s fresh |
|00002240| 63 6f 70 79 20 6f 66 20 | 73 20 77 69 74 68 20 65 |copy of |s with e|
|00002250| 73 63 61 70 65 73 20 74 | 72 61 6e 73 6c 61 74 65 |scapes t|ranslate|
|00002260| 64 20 2a 2f 0d 3c 3c 43 | 20 66 75 6e 63 74 69 6f |d */.<<C| functio|
|00002270| 6e 73 3e 3e 3d 0d 63 68 | 61 72 20 2a 75 6e 65 73 |ns>>=.ch|ar *unes|
|00002280| 63 61 70 65 20 28 63 68 | 61 72 20 2a 73 29 20 7b |cape (ch|ar *s) {|
|00002290| 0d 20 20 20 20 63 68 61 | 72 20 2a 74 20 3d 20 6d |. cha|r *t = m|
|000022a0| 61 6c 6c 6f 63 28 73 74 | 72 6c 65 6e 28 73 29 2b |alloc(st|rlen(s)+|
|000022b0| 31 29 3b 0d 20 20 20 20 | 63 68 61 72 20 2a 72 20 |1);. |char *r |
|000022c0| 3d 20 74 3b 0d 20 20 20 | 20 63 68 65 63 6b 70 74 |= t;. | checkpt|
|000022d0| 72 28 74 29 3b 0d 20 20 | 20 20 77 68 69 6c 65 20 |r(t);. | while |
|000022e0| 28 2a 73 20 21 3d 20 27 | 5c 30 27 29 20 7b 0d 20 |(*s != '|\0') {. |
|000022f0| 20 20 20 20 20 20 20 69 | 66 20 28 2a 73 20 3d 3d | i|f (*s ==|
|00002300| 20 61 74 5f 73 69 67 6e | 29 20 7b 0d 20 20 20 20 | at_sign|) {. |
|00002310| 20 20 20 20 20 20 20 20 | 69 66 20 28 21 73 74 72 | |if (!str|
|00002320| 6e 63 6d 70 28 73 2b 31 | 2c 22 40 3c 3c 22 2c 32 |ncmp(s+1|,"@<<",2|
|00002330| 29 20 7c 7c 20 21 73 74 | 72 6e 63 6d 70 28 73 2b |) || !st|rncmp(s+|
|00002340| 31 2c 22 40 3e 3e 22 2c | 32 29 29 20 73 2b 2b 3b |1,"@>>",|2)) s++;|
|00002350| 0d 20 20 20 20 20 20 20 | 20 7d 0d 20 20 20 20 20 |. | }. |
|00002360| 20 20 20 2a 74 2b 2b 20 | 3d 20 2a 73 2b 2b 3b 0d | *t++ |= *s++;.|
|00002370| 20 20 20 20 7d 0d 20 20 | 20 20 2a 74 20 3d 20 27 | }. | *t = '|
|00002380| 5c 30 27 3b 0d 0d 20 20 | 20 20 72 65 74 75 72 6e |\0';.. | return|
|00002390| 20 72 3b 0d 7d 0d 40 20 | 25 64 65 66 20 75 6e 65 | r;.}.@ |%def une|
|000023a0| 73 63 61 70 65 0d | |scape. | |
+--------+-------------------------+-------------------------+--------+--------+